package game.components;

import java.awt.Graphics2D;
import java.awt.Point;


public class TableChess {
	private AppUtilities appUtilities;
	private int cellSize;
	private int width;

	public TableChess(AppUtilities appUtilities) {
		this.appUtilities = appUtilities;
		this.width = appUtilities.getWidthOfX_O();
		this.cellSize = appUtilities.getCellSize();
	}

	public int getSize() {
		return appUtilities.getTableSize();
	}

	public int getCenter() {
		return (appUtilities.getTableSize() / 2 + 1);
	}

	public void draw_R(Graphics2D g, Point location) {
		int width = cellSize - this.width * 2 + 1;
		int posX = location.x * cellSize + this.width;
		int posY = location.y * cellSize + this.width;

		g.fillRect(posX, posY, width, width);
	}

	public void draw_O(Graphics2D g, Point location) {
		int width = cellSize - this.width * 2 + 1;
		int posX = location.x * cellSize + this.width;
		int posY = location.y * cellSize + this.width;

		g.fillOval(posX, posY, width, width);
	}

	public int getCellSize() {
		return cellSize;
	}

	public int getWidth() {
		return width;
	}

	public void setAppUtilities(AppUtilities appUtilities) {
		this.appUtilities = appUtilities;
	}
}
